<!-- 表格内容,此组件还用于生成导出文件,所以不应该依赖vue组件相关的上下文 -->
<script lang="ts" setup>
import { HAS_WARING_MAP } from "@/config/enum-map";
import {
	getEnumOptionsField,
	RISK_HAZARDS_CONTROL_DANGER_STATUS_OPTIONS,
} from "@/config/enum-options";
import bus from "vue3-eventbus";

defineOptions({ name: "SheetItem" });

const showWaring = (val:any) => {
  console.log(val)
  bus.emit('waring',val)
}
</script>

<template>
	<el-table-column label="序号" type="index" width="60" fixed="left" />
	<el-table-column label="风险描述" prop="dangerDesc" />
	<el-table-column label="责任人员" prop="masterName" />
	<el-table-column label="联系电话" prop="masterPhone" />
	<el-table-column label="管控措施" prop="handleDesc" />
	<el-table-column label="风险日常检查表" prop="dailyCheckFileName" />
	<el-table-column v-slot="{ row }" label="风险状态" prop="dangerStatus">
		{{
			getEnumOptionsField(
				RISK_HAZARDS_CONTROL_DANGER_STATUS_OPTIONS,
				"label",
				row.dangerStatus,
			)
		}}
	</el-table-column>
	<el-table-column v-slot="{ row }" label="预警提醒" 
  prop="hasWaring">
    <el-button size="small" text @click="showWaring(row)">
      {{ HAS_WARING_MAP[row.hasWaring] }}
    </el-button>
		<!-- {{ HAS_WARING_MAP[row.hasWaring] }} -->
	</el-table-column>
</template>
